#ifndef _UTIL_H_
#define _TUIL_H_

#include "./include/sys_type.h"

void SafeMemCpy(char* theDst, const char* theSrc, u32 theLength);

void DebugOut(u8* theString);

void BUG(void);

#define CHECKF( Expression)  do {   \
                                if(!(Expression)) \
                                  {                 \
                                    BUG();          \
                                    return -1;      \
                                  }                 \
                                }while(0);        

#define CHECK( Expression)  do {                  \
                                if(!(Expression)) \
                                  {               \
                                    BUG();        \
                                    return ;      \
                                  }               \
                                }while(0);        

#ifdef APP_DEBUG

#define MY_ASSERT(Expression) do {                \
                                 if(!(Expression))  \
                                   BUG();         \
                                 } while(0);
#else
#define MY_ASSERT(Expression) 
#endif

#include "./include/sys_time.h"
#ifdef PLATFORM_C7S
#define OS_DelayMs(Timeout) OS_Delay(Timeout/10)
#else
#define OS_DelayMs(Timeout) OS_Delay(Timeout)
#endif


bool FindData(const char* theData, 
                    int theDataLength, 
                    const char* theSubData,
                    int theSubDataLength);

#endif
